% use COM slope
function plot_outputs_COM(LineNumber,model_name)


switch model_name
    case 'human_mean'
        load('/home/shu/workspace/Research/2DKnee_Torso_Outputs/data/IndexAll.mat')
        % choose load which matrix
        str_linenumber = num2str(LineNumber);
        amat_name = [str_linenumber 'a_opt.mat'];
        
        load(['/home/shu/workspace/Research/2DKnee_Torso_Outputs/result/' amat_name]);
        a0 = a_opt;
        % choose the output combination
        hiptype = IndexAll(LineNumber,1);
        slopetype = IndexAll(LineNumber,2);
        torsotype = IndexAll(LineNumber,3);
        load('HUMAN_1013.mat');
        ns_time = mean(time_rec)*ave_timeSK';
    case 'NAO'
        load('/home/shu/workspace/Research/NAO_Output_Test/data/IndexAll.mat')
        % choose load which matrix
        str_linenumber = num2str(LineNumber);
        amat_name = [str_linenumber 'a_opt.mat'];
        
        load(['/home/shu/workspace/Research/NAO_Output_Test/result/' amat_name]);
        a0 = a_opt;

% choose the output combination
        hiptype = IndexAll(LineNumber,1);
        slopetype = IndexAll(LineNumber,2);
        torsotype = IndexAll(LineNumber,3);
        load('NAO_1013_2.mat');
        ns_time = mean(time_rec)*ave_timeSK';
    case 'AMBER'
        load('/home/shu/workspace/Research/AMBER_Output_Test/data/IndexAll.mat')
        % choose load which matrix
        str_linenumber = num2str(LineNumber);
        amat_name = [str_linenumber 'a_opt.mat'];
        
        load(['/home/shu/workspace/Research/AMBER_Output_Test/result/' amat_name]);
        a0 = a_opt;
        % choose the output combination
        hiptype = IndexAll(LineNumber,1);
        slopetype = IndexAll(LineNumber,2);
        torsotype = IndexAll(LineNumber,3);
        load('AMBER_1013.mat');
        ns_time = mean(time_rec)*ave_timeSK';
        
end

% for hip related output
if hiptype == 1
    meanValuePlotG1(ave_timeHP,upperBHP,lowerBHP,x_meanHP,'HipPos.eps',...
        'Position(m)',a0(1,:),1,ns_time,1,LineNumber);
elseif hiptype == 2
    meanValuePlotG1(ave_timeHPL,upperBHPL,lowerBHPL,x_meanHPL,'HipPosLinear.eps',...
        'Position(m)',a0(1,:),1,ns_time,2,LineNumber);
end


% for non-stance slope related outputs
if slopetype == 1 % non-stance slope
    meanValuePlotG1(ave_timeNSslope,upperBNSL,lowerBNSL,x_meanNSL,'NSSlope.eps',...
        'Slope',a0(2,:),2,ns_time,3,LineNumber)
elseif slopetype == 2 % linearized non-stance slope
    meanValuePlotG1(ave_timeNSSslopeL,upperBLNS,lowerBLNS,x_meanLNS,'LNS.eps',...
        'Slope',a0(2,:),2,ns_time,4,LineNumber)
elseif slopetype == 3 % hip angel
    meanValuePlotG1(ave_timeHip,upperBHip,lowerBHip,x_meanHip,'HipAngle.eps',...
        'Angle(rad)',a0(2,:),2,ns_time,5,LineNumber);
end

% for torsorelated outputs
if torsotype == 1 % torso hip angle
    meanValuePlotG1(ave_timeTH,upperBTH,lowerBTH,x_meanTH,'TorsoAngle.eps',...
        'Angle(rad)',a0(5,:),2,ns_time,8,LineNumber);
elseif torsotype == 2 % stance COM slope
    meanValuePlotG1(ave_timeT4,upperBT4,lowerBT4,x_meanT4,'Theta4.eps',...
        'Angle(rad)',a0(5,:),2,ns_time,9,LineNumber);
elseif torsotype == 3 % linearized COM slope
    meanValuePlotG1(ave_timeNST,upperBNST,lowerBNST,x_meanNST,'NSTorsoSlope.eps',...
        'Slope',a0(5,:),2,ns_time,10,LineNumber);
end

% stance knee
meanValuePlotG1(ave_timeSK,upperBSK,lowerBSK,x_meanSK,'SKnee.eps',...
    'Angle(rad)',a0(3,:),2,ns_time,6,LineNumber);
% non stance knee
meanValuePlotG1(ave_timeNSK,upperBNSK,lowerBNSK,x_meanNSK,'NSKnee.eps',...
    'Angle(rad)',a0(4,:),2,ns_time,7,LineNumber)

% mkdir([model_name 'figure']);
movefile('figure/*.eps',[model_name 'figure'])
close all;
end